package cn.edu.lcu.cs.javaweb.web;

import java.io.IOException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import cn.edu.lcu.cs.javaweb.dao.UserDaoImpl;
import cn.edu.lcu.cs.javaweb.entity.User;
import cn.edu.lcu.cs.javaweb.dao.UserDao;

@WebServlet("/el")
public class ELServlet extends HttpServlet {
	private UserDao userDao = new UserDaoImpl();

	public ELServlet() {
		super();
	}

	protected void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		List<User> users = userDao.findAll();
		User user = users.get(0);
		request.setAttribute("user", user);
		request.setAttribute("users", users);
		request.getRequestDispatcher("el.jsp").forward(request, response);
		
	}

	protected void doPost(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
	}

}
